package com.ykdl.app.prefs;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;



import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;

/**
 * 记录程序中的一些小的数据
 * 
 * @param result
 */
public class MyPrefs {
	private static SharedPreferences settings;
	private static SharedPreferences.Editor editor;
	public static void init(Context ctx) {
		if (editor == null) {
			if (settings == null) {
				settings = ctx.getSharedPreferences("hys", Context.MODE_PRIVATE);
				editor = settings.edit();
			} else {
				editor = settings.edit();
			}
		}
	}
	
	
	
	public static void putisFirst(Context mContext,String data) {
		SharedPreferences settings = mContext.getSharedPreferences("isFirst", 0);
		SharedPreferences.Editor editor = settings.edit();
		editor.putString("isFirst",data);
		editor.commit();
	}
	public static String getisFirst(Context mContext) {
		SharedPreferences settings = mContext.getSharedPreferences("isFirst", 0);
		String data = settings.getString("isFirst","");
		return data;
		
	}
	
	public static String getStoreName(Context mContext){
		SharedPreferences settings = mContext.getSharedPreferences("ShopMainBean", 0);
		String data = settings.getString("name","");
		return data;
	}
	public static String getStoreID(Context mContext){
		SharedPreferences settings = mContext.getSharedPreferences("ShopMainBean", 0);
		String data = settings.getString("Store_id","");
		return data;
	}
	public static String getStoreIndustryID(Context mContext){
		SharedPreferences settings = mContext.getSharedPreferences("ShopMainBean", 0);
		String data = settings.getString("industry_id","");
		return data;
	}
	
	// 拍照的路径
		public static void setCamePath(Context context, String path) {
		
			editor.putString("curcame", path);
			editor.commit();
		}

		public static String getCamePath(Context context) {
			
			return settings.getString("curcame", "");
		}
		
		public static String getCategoryVer(Context mContext) {
			SharedPreferences settings = mContext.getSharedPreferences("category_ver", 0);
			String data = settings.getString("category_ver","");
			return data;
		}
		
		public static void setCategoryVer(Context mContext,String category_ver){
			SharedPreferences settings = mContext.getSharedPreferences("category_ver", 0);
			SharedPreferences.Editor editor = settings.edit();
			editor.putString("category_ver",category_ver);
			editor.commit();
		}
		public static Boolean getNew_category(Context mContext) {
			SharedPreferences settings = mContext.getSharedPreferences("new_category", 0);
			Boolean  data = settings.getBoolean("new_category", true);
			return data;
		}
		
		public static void setNew_category(Context mContext,boolean category_ver){
			SharedPreferences settings = mContext.getSharedPreferences("new_category", 0);
			SharedPreferences.Editor editor = settings.edit();
			editor.putBoolean("new_category",category_ver);
			editor.commit();
		}
		
		public static void clearConfig(Context mContext){
			
			mContext.getSharedPreferences("ShopMainBean", 0).edit().clear().commit();
			
			
			
		}
}
